package vip.liux.contracts.models.identity;

import jakarta.persistence.*;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "identity_user_roles")
public class IdentityUserRole {
    @EmbeddedId
    private IdentityUserRoleId id;

    @MapsId("userId")
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "user_id", nullable = false)
    private IdentityUser user;

    @MapsId("roleId")
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "role_id", nullable = false)
    private IdentityRole role;

    @Size(max = 36)
    @Column(name = "tenant_id", length = 36)
    private String tenantId;

}